package com.wanmait.employment.manageController;

import com.wanmait.employment.entity.MaritalStatus;
import com.wanmait.employment.service.MaritalStatusService;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("manage/MaritalStatus")
public class MaritalStatusController {
    @Resource
    private MaritalStatusService maritalStatusService;
    @GetMapping("list")
    public AjaxResult list(String title){
        List<MaritalStatus> maritalStatusPageInfo = maritalStatusService.selectList( title);
        return AjaxResult.success(maritalStatusPageInfo);
    }
    @PostMapping("update")
    public AjaxResult update(@RequestBody MaritalStatus maritalStatus){
        if(maritalStatus.getId()!=null) {
            maritalStatusService.update(maritalStatus);
            return AjaxResult.success("成功");
        }
        maritalStatusService.insert(maritalStatus);
        return AjaxResult.success("成功");
    }
    @GetMapping("delete")
    public void delete(Integer id){
        maritalStatusService.delete(id);
    }
}

